double Zmin = -100; //Max.Z depth double Feedrate = 250; //Feedrate for probing double retractheight = 5; //The retract height double newZ = 39.3; //The new Z DRO value after probing exec.Code("G31 Z" + Zmin + "F" + Feedrate); // Start probing while(exec.IsMoving()){} // Wait while there is motion exec.Wait(200); //Safety wait for the UC100 syncronisation exec.ChangeaxisDROvalue(2, newZ.ToString()); //Change the DRO value exec.Wait(200); //Safety wait for the UC100 syncronisation if(!exec.Ismacrostopped()) // If tool change was not interrupted with a stop only then validate new tool number { double Zup = exec.GetZmachpos() + retractheight; //Calculate the new coordinate for the retract of Z axis exec.Code("G00 G53 Z" + Zup); //Retract the Z-axis while(exec.IsMoving()){} // Wait while there is motion }